package admin

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	"server/api/admin/system"
)

func (c *ControllerSystem) AdminUpdate(ctx context.Context, req *system.AdminUpdateReq) (res *system.AdminUpdateRes, err error) {
	res = new(system.AdminUpdateRes)
	err = service.SystemUser().UpdateById(ctx, req.Id, model.SystemUserUpdateInput{
		Username: req.Username,
		Name:     req.Name,
		Avatar:   req.Avatar,
		RoleIds:  req.RoleIds,
		Phone:    req.Phone,
	})
	return
}
